package com.drawu.drawuspring.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.drawu.drawuspring.domain.VO.CommentVO;
import com.drawu.drawuspring.domain.VO.PostVO;
import com.drawu.drawuspring.domain.po.CommentPO;
import com.drawu.drawuspring.domain.po.Posts;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ForumMapper extends BaseMapper<Posts> {

//    @Select("SELECT * FROM posts LEFT JOIN users ON users.openid = posts.openid ORDER BY posts.create_time DESC")
//    List<PostVO> getAllPosts();
//
//    @Select("SELECT * FROM posts LEFT JOIN users ON users.openid = posts.openid WHERE id = #{id}")
//    PostVO getPostDetail(String id);
//
//    @Select("SELECT url FROM images WHERE targetId = #{id}")
//    List<String> getImages(String id);
//
//    @Insert("INSERT INTO comments (id, postId, openid, receiverId, fatherId ,replyCommentId , content) " +
//            "VALUES (UUID(), #{postId}, #{openid}, #{receiverId}, #{fatherId} , #{replyCommentId}, #{content})")
//    int replyPost(CommentPO commentPO);
//
//    @Select("SELECT * FROM comments LEFT JOIN users ON users.openid = comments.openid " +
//            "WHERE post_id = #{postId} AND father_id IS NULL ORDER BY comments.create_time DESC")
//    List<CommentVO> getFatherComment(Integer postId);
//
//    @Select("SELECT * FROM comments LEFT JOIN users ON users.openid = comments.openid " +
//            "WHERE postId = #{postId} AND fatherId IS NOT NULL ORDER BY comments.createTime DESC")
//    List<CommentVO> getSonComment(Integer postId);
//
//    @Insert("INSERT INTO posts (id, openid, title, content, area) VALUES (#{id}, #{openid}, #{title}, #{content}, #{area})")
//    int createPost1(Posts posts);
//    int createPost2(Posts posts);
}
